<template>
  <div class="layout-page">
   <router-view></router-view>

    <van-tabbar v-model="active" route>
      <van-tabbar-item to="/mainpage" icon="wap-home-o">首页</van-tabbar-item>
      <van-tabbar-item to="/findhouse" icon="search">找房</van-tabbar-item>
      <van-tabbar-item to="/information" icon="newspaper-o">资讯</van-tabbar-item>
      <van-tabbar-item :to="token? '/users' : '/user'" icon="user-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import { getToken } from '@/utils/storage'
export default {
  name: 'layout-page',
  data () {
    return {
      active: 0,
      token: getToken()
    }
  },
  methods: {
  }
  // watch: {
  //   user: {
  //     handler () {
  //       const token = getToken()
  //       if (token) { this.user = '/users' } else {
  //         this.user = '/user'
  //       }
  //     }

  //   }
  // }
}
</script>

<style lang="less" scoped>

</style>
